package com.lin.filegraph.utils.componentRule;

import com.lin.filegraph.utils.compdg.ComponentEdge;
import com.lin.filegraph.utils.compdg.ComponentGraph;

/**
 * @description:
 * @author: linhuaixu
 * @time: 2023/5/18 16:08
 */

public class DetectLogic {

    public static void unionInherOrCombin(ComponentGraph graph) {
        boolean isFind =false;
        for (ComponentEdge ce : graph.getAllComponentEdges()) {
            if(ce.isHasInherOrCombin()&&ce.getPreComponent().isFeature()==false&&ce.getPostComponent().isFeature()==false){

                graph.mergeNodes(ce.getPreComponent(), ce.getPostComponent());
                isFind= true;
                break;
            }
        }
        if(isFind)
            unionInherOrCombin(graph);
    }

}

